package org.teststack.Api.Sl;

import com.jayway.restassured.RestAssured;
import com.jayway.restassured.response.Response;
import org.teststack.Api.RestClient;

import java.util.HashMap;
import java.util.Map;

import static org.teststack.Api.CookieManager.cookies;


public class QykbApi {

    public static void main(String[] args) {    //企业开办
        qykbApi();
    }
    public static int qykbApi() {
        // 登录并更新cookies
        RestClient.loginAndUpdateCookies("liutao", "xQ5Vea/L3CMRNEwoBESSZGSVCnValY4kZcAYe3153B9/dXpazZRG8VLEuMhJdW1RhdZ/cqdUq/5FUdAxeKzdWOmZEj0sVlobwrqzRMgrIPsvyp03QTktVYRUAgloA924e5wLLSx8ECJ4WpUAB8zUa41GkyURFmyVtwxQ3EkLuabQ7V24L8EdzRfBHnFd8zRRd4RkncACXO88rrb4U7uR10ANvR0K4N2Kiai901pyztSuMfXP0fVRBW1lKj+kIONtFufTZoAL48++Q6VVr3r5B9tIC4kkwv0WzQxeOubbVKTNUi1JGnS2CEPPqjuXWJnUAO3u5PRxXmtH5+JN8yXygw==");


        Map<String, String> formParams = new HashMap<>();
        formParams.put("method", "enterMczzcc");
        formParams.put("sbms", "1");
        formParams.put("qylx", "qy");


        Response response = RestAssured.given()


                .cookies(cookies)
                .params(formParams)

                .post("http://10.1.10.141:9031/ywtSldj.do?method=enterMczzcc&sbms=1&qylx=qy&fromSign=&csrftoken="); // 注意：可能需要有效的 CSRF Token

        int statusCode = Integer.parseInt(String.valueOf(response.getStatusCode()));
        Map<String, String> cookies = response.getCookies();
        System.out.println(statusCode);



        return statusCode;
    }
}
